home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / tilebi1a / tilebitm.bas < prev    next >
Encoding:
BASIC Source File  |  1998-04-24  |  971 b   |  37 lines

  1. Attribute VB_Name = "TileBitMap"
  2. Option Explicit
  3. Public Sub TilePicture(frmDest As Form, picSource As PictureBox)
  4.   
  5.   Dim iPicWidth As Integer
  6.   Dim iPicHeight As Integer
  7.   Dim iFormWidth As Integer
  8.   Dim iFormHeight As Integer
  9.   Dim x As Integer
  10.   Dim y As Integer
  11.   Dim iResult As Integer
  12.   Dim iOldScale As Integer
  13.  
  14.   ' Get the picture width and height in pixels
  15.   iOldScale = picSource.ScaleMode
  16.   picSource.ScaleMode = 3
  17.   iPicWidth = picSource.ScaleWidth
  18.   iPicHeight = picSource.ScaleHeight
  19.   picSource.ScaleMode = iOldScale
  20.   
  21.   'Get the Forms width and height in pixels
  22.   iFormWidth = frmDest.Width / Screen.TwipsPerPixelX
  23.   iFormHeight = frmDest.Height / Screen.TwipsPerPixelY
  24.   
  25.   For x = 0 To iFormWidth Step iPicWidth
  26.      
  27.      For y = 0 To iFormHeight Step iPicHeight
  28.         
  29.         iResult = BitBlt(frmDest.hdc, x, y, iPicWidth, iPicHeight, _
  30.         picSource.hdc, 0, 0, SRCCOPY)
  31.      
  32.      Next
  33.   
  34.   Next
  35.  
  36. End Sub
  37.